
import java.awt.*;
import java.awt.event.*;
import java.util.EventListener;
import javax.swing.*;

import netscape.javascript.*;

//this is the main class (init())

public class DoodlePassword2 extends DoodlePassword{

//	protected  ScribbleCanvas canvas;
	ControlPanel panel;
	DoodlePassword2 dp2;
	DoodlePassword dp;
	private JTextField textPassword;
	
	
	public DoodlePassword2(){
		super();

		
		
//		panel = new ControlPanel(canvas, password,win);
//		getContentPane().add(panel, BorderLayout.SOUTH);
		

		//getContentPane().add(makeControlPanel(), BorderLayout.SOUTH);
	}

//	protected Component makeControlPanel() {
//		
//	//Lower Panel, which contains clear and See Password buttons and Field to see password.	
//		
//		
//		JPanel controlPanel = new JPanel();
//		BoxLayout layout = new BoxLayout(controlPanel, BoxLayout.LINE_AXIS);
//		controlPanel.setLayout(layout);
//		
//		JButton buttonClear = new JButton("Clear");
//		controlPanel.add(buttonClear, layout);
//		//controlPanel.add(buttonClear);
//		buttonClear.addActionListener(new ClearButtonListener());
//		
//		controlPanel.add(new JLabel("Password: "), layout);
//		//controlPanel.add(new JLabel("Password: "));
//		
//		
//		textPassword = new JTextField("\t\t");
//		controlPanel.add(textPassword, layout);
//	 	//controlPanel.add(textPassword);
//	 	
//	 	 
//	 	JButton buttonGetPass = new JButton("See Password");
//		buttonGetPass.addActionListener(new PasswordButtonListener());
//		controlPanel.add(buttonGetPass, layout);
//		controlPanel.add(buttonGetPass);
//		
//		return controlPanel;
//		
//	
//		
//	}
	
	
	public void init(){
		frameW= 400;
		frameH= 400;
		
		dp2 = new DoodlePassword2 ();
		dp = new DoodlePassword ();
		
		try{
			win = netscape.javascript.JSObject.getWindow(this);
			win.call("testeJS", null);
			
		} 
		catch(JSException jse) {
				jse.printStackTrace();
				} catch (Exception e) {
				e.printStackTrace();
		}
		
		
		this.getContentPane().setLayout(new BorderLayout());
		
		this.getContentPane().add(dp2, BorderLayout.CENTER);
		
		
		panel = new ControlPanel(canvas, password,win);		
		this.getContentPane().add(panel, BorderLayout.SOUTH);
		
		
		//this.addWindowListener(new AppCloser());
		//this.pack();
		//this.setResizable(false);
		//this.setSize(frameW, frameH);
		
		this.show();

		
		
	}
	
//	//clear button action
//	class ClearButtonListener implements ActionListener{
//		public void actionPerformed(ActionEvent event){
//			canvas.clearCanvas();
//			password.clearPassword();
//			textPassword.setText(password.getPassword());
//			canvas.repaint();
//		}
//	}
//	
//	//See password button action.
//	class PasswordButtonListener implements ActionListener{
//		public void actionPerformed(ActionEvent event){
//			textPassword.setText(password.getPassword());
//			
//		}
//	}
	
	
}
